<?php /* Smarty version 2.6.20, created on 2017-05-07 07:46:30
         compiled from lostmobile.htm */ ?>
﻿<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "header.htm", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

  <!-- 中间内容开始 -->
  <div class="bigauto">
  	<div class="width_1200">
    
    
    	<!--用户空间开始-->
			<div class="user_space_big">
        <!--用户空间内容开始-->
        <div class="user_con">
          <div class="user_setup">
          	<h3><?php echo $this->_tpl_vars['lang']['callpass']; ?>
</h3>
            <div class="user_detailed">
                <?php if ($this->_tpl_vars['action'] == 'get_mobile'): ?>
                     <form id="changefrm" action="" method="get" onsubmit=" return check_data();">
                    <table width="1018" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <th height="45" align="right" scope="row">手机号：</th>
                            <td><input name="mobile" class="text" type="text" id="mobile" size="25" value="<?php echo $_POST['user']; ?>
" style="width:300px; height: 33px; "/><s><label class="tip"></label></s></td>
                        </tr>
                        <tr>
                            <th height="45" align="right" scope="row">验证码：</th>
                            <td>
                                <input name="code" id="code" class="text" size="25" type="text" style="height: 33px; margin-right: 10px;" />
                                <img class="yz_img" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/includes/rand_func.php?rand=<?php echo $this->_tpl_vars['now_time']; ?>
" style="cursor:pointer" title="点击我更换图片" alt="点击我更换图片">
                            </td>
                        </tr>

                        <tr>
                            <th height="45" scope="row">&nbsp;</th>
                            <input name="action" type="hidden" value="get_mobile" />
                            <td><input class="save" type="submit" value="下一步" /></td>
                        </tr>
                    </table>
                </form>
                <?php endif; ?>

                <?php if ($this->_tpl_vars['action'] == 'mobile_pass'): ?>
                <form  action="" method="post"  onsubmit=" return check_up_mobile(); ">
                    <table width="1018" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <th height="45" align="right" scope="row">手机号：</th>
                            <td><input name="mobile" id="mobile" class="text" type="text" size="25" value="<?php echo $_GET['mobile']; ?>
" style="width:300px; height: 33px; "/><s><label class="tip"></label></s></td>
                        </tr>
                        <tr>
                            <th height="45" align="right" scope="row">验证码：</th>
                            <td>
                                <input name="sms_code" id="sms_code" class="text" size="25" type="text" style="height: 33px; margin-right: 10px;" />
                                <span style=" display: block; float: left; width: 90px; height: 33px; line-height: 33px; text-align: center; background:#e77817; color: #fff; font-size: 14px; margin-left: 5px; cursor: pointer;" id="sendCode">点击发送</span>
                            </td>
                        </tr>

                        <tr>
                            <th height="45" align="right" scope="row">密码：</th>
                            <td><input name="password" id="password" class="text" type="password" size="25"  placeholder="请输入新密码" /><s><label class="tip"></label></s></td>
                        </tr>

                        <tr>
                            <th height="45" scope="row">&nbsp;</th>
                            <input name="lostpass" type="hidden" value="lostpass" />
                            <td><input class="save" type="submit" value="提价" /></td>
                        </tr>
                    </table>
                </form>
                <?php endif; ?>

            </div>
          </div>
        </div>
        <!--用户空间内容结束-->
      </div>
      <!--用户空间结束-->
      
    </div>
  </div>
  <!-- 中间内容结束 -->
    <link href="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/templates/default/css/space.css?v=<?php echo $this->_tpl_vars['now_time']; ?>
" rel="stylesheet" media="screen" type="text/css" />

<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "footer.htm", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<script type="application/javascript">
    $(".yz_img").on('click',function(){
        $(this).attr('src', "<?php echo $this->_tpl_vars['config']['weburl']; ?>
/includes/rand_func.php?rand=" + Math.random());
    });

    function check_data(){
        var mobile = $("#mobile").val();
        var code   = $("#code").val();
        var preg_mobile = /^1\d{10}$/;
        if(mobile == ''){
            alert('手机号不能为空');
            return false;
        } else if(!preg_mobile.test(mobile)){
            alert("请填写正确的手机号");
            return false;
        } else {
            return true;
        }

    }

    $(function() {
        //发送短信
        $("#sendCode").on("click",function(){
            var mobile = $("#mobile").val();
            var mobile_part = /^1\d{10}$/;
            if(mobile == ''){
                alert("请填写手机号");
                return false;
            } else if(!mobile_part.test(mobile)){
                alert("请填写正确的手机号");
                return false;
            } else {
                if($(this).hasClass("on")){
                    return false;
                }
                $.post("ajax_back_end.php",{action:'sendSms',mobile:mobile},function(ret){
                    ret = eval('('+ret+')');
                    if(!ret.status){
                        alert(ret.msg);
                    } else {
                        settime(60);
                    }

                });


            }
        });

        var countdown = 60;
        function settime(val) {
            if (countdown == 0) {
                $("#sendCode").removeClass("on");
                $("#sendCode").html("点击发送");
                return false;
            } else {
                $("#sendCode").html("重新发送" + countdown + 's');
                countdown--;
                $("#sendCode").addClass("on");
            }
            setTimeout(function() {
                settime(val)
            },1000)
        }

    });

    function check_up_mobile(){
        var mobile = $("#mobile").val();
        var sms_code   = $("#sms_code").val();
        var preg_mobile = /^1\d{10}$/;
        var password = $("#password").val();
        if(mobile == ''){
            alert('手机号不能为空');
            return false;
        } else if(!preg_mobile.test(mobile)){
            alert("请填写正确的手机号");
            return false;
        } else if(sms_code == ''){
            alert('验证码不能为空');
            return false;
        } else if(password == ''){
            alert('密码不能为空');
            return false;
        } else if(password.length < 6 ){
            alert('密码长度不能小于6位');
            return false;
        } else {
            return true;
        }
    }


</script>